<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j" template="/users/users-frame.xhtml">

	<ui:param name="pageTitle" value="BIK" />

	<ui:define name="subheader">BIK</ui:define>

	<ui:define name="main">
		<a:form id="userListForm2">
			<h:commandLink
				action="#{bikBean.getCustomerObligationsFromBik('11')}"
				style="float:left; background-color: transparent;">
				<h:outputText value="get obligations" />
			</h:commandLink>
		</a:form>

		<a:form id="personListForm">

			<rich:extendedDataTable value="#{personBean.getAll()}" var="person"
				sortMode="single" rows="20"
				onRowMouseOver="this.className='extdt-row-selected'"
				onRowMouseOut="this.className=''" id="personListTable">
				
				<f:facet name="header">
					<h:outputText value="Zobowiązania klientów z BIKu:" />
				</f:facet>

				<rich:column sortable="true" sortBy="#{person.firstname}"
					filterBy="#{person.firstname}"
					label="#{messages['person.firstname']}" width="25%">
					<f:facet name="header">#{messages['person.firstname']}</f:facet>
					<h:outputText value="#{person.firstname}" />
				</rich:column>

				<rich:column sortable="true" sortBy="#{person.lastname}"
					filterBy="#{person.lastname}"
					label="#{messages['person.lastname']}" width="25%">
					<f:facet name="header">#{messages['person.lastname']}</f:facet>
					<h:outputText value="#{person.lastname}" />
				</rich:column>

				<rich:column sortable="true" sortBy="#{person.pesel}"
					filterBy="#{person.pesel}" label="#{messages['person.pesel']}"
					width="25%">
					<f:facet name="header">#{messages['person.pesel']}</f:facet>
					<h:outputText value="#{person.pesel}" />
				</rich:column>

				<rich:column label="#{messages['address']}" width="25%">
					<f:facet name="header">#{messages['address.street']}</f:facet>
					<h:outputText value="#{person.address.street}" />
				</rich:column>

				<a:support event="onRowClick"
					action="#{bikBean.getCustomerObligationsFromBik(person.pesel)}" />

				<f:facet name="footer">
					<rich:datascroller for="personListTable"
						id="personListTableScroller" />
				</f:facet>
			</rich:extendedDataTable>
		</a:form>
	</ui:define>
</ui:composition>
